<?php

class ReasonTable extends Doctrine_Table
{
    public function ajaxAutocompleter($value)
    {
        $q = $this->createQuery('r')
                 ->where("(r.name) like (?)", '%'.$value.'%');
        $r = $q->execute();
        $json = array();
        foreach ($r as $data)
        {
            if (!in_array($data->__toString(), $json))
                $json[$data->getId()] = $data->__toString();
        }
        return $json;
    }
}